/*
 * @author: Jay
 * @description: 监听主题变化
 * @createTime: 2022-12-12 15:22:19
 */
import {
	mapMutations,
	mapGetters
} from "vuex"
export default {
	install(Vue) {
		Vue.mixin({
			onShow() {
				// 获取缓存 主题名字
				const themeType = uni.getStorageSync("themeType") || "";
				if (themeType) {
					this.cueGetTheme(themeType)
				}
			},
			computed: {
				// 获取vuex 主题参数
				...mapGetters({
					cueTheme: "theme/theme",
					pageBg: "theme/pageColor",
				}),
			},
			methods: {
				// 修改主题
				...mapMutations({
					cueGetTheme: "theme/GET_THEME",
					themeCache: "theme/SET_THEME_CACHE",
				}),

			}
		})
	}
}
